package bubuntux.jusbscan.tui;

import java.util.ArrayList;

import jcurses.system.Toolkit;
import jcurses.widgets.GridFlowLayoutManager;
import jcurses.widgets.WidgetsConstants;
import jcurses.widgets.Window;

public class FrameContainer extends Window implements WidgetsConstants {

	public FrameContainer(ArrayList<Frame> frames) {
		this(frames, Toolkit.getScreenWidth(), Toolkit.getScreenHeight());
	}

	public FrameContainer(ArrayList<Frame> frames, int width, int height) {
		this(frames, width, height, true);
	}

	public FrameContainer(ArrayList<Frame> frames, int width, int height,
			boolean border) {
		this(frames, width, height, border, "jUSB-Scan");
	}

	public FrameContainer(ArrayList<Frame> frames, int width, int height,
			boolean border, String title) {
		super(width, height, border, title);
		this.setShadow(false);
		this.setClosingChar(null);

		GridFlowLayoutManager manager = new GridFlowLayoutManager(frames.size());

		getRootPanel().setLayoutManager(manager);

		for (Frame frame : frames) {
			manager.addWidget(frame);
		}

	}

}
